package com.supplychain.scm.core.task.enums;

import com.supplychain.scm.core.basis.enums.IBaseEnum;
import com.supplychain.scm.core.basis.util.EnumUtils;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;

import java.util.Arrays;

/**
 * 业务任务类型枚举
 *
 * @Author yangyong
 * @Date 2023/11/30
 */
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public enum BizTaskTypeEnum implements IBaseEnum<String, String> {
    /**
     * 商品库本地商品导入
     */
    SUPPLY_CHAIN_LOCAL_PRODUCT_IMPORT("SUPPLY_CHAIN_LOCAL_PRODUCT_IMPORT", "商品库本地商品导入"),
    /**
     * 商品库批量定价导入
     */
    SUPPLY_CHAIN_PRODUCT_PRICE_IMPORT("SUPPLY_CHAIN_PRODUCT_PRICE_IMPORT", "商品库批量定价导入"),
    /**
     * 商品分组批量导入关联商品
     */
    SUPPLY_CHAIN_PRODUCT_GROUP_RELATED_GOODS_IMPORT("SUPPLY_CHAIN_PRODUCT_GROUP_RELATED_GOODS_IMPORT", "商品分组批量导入关联商品"),
    /**
     * 商品品牌批量导入关联商品
     */
    SUPPLY_CHAIN_PRODUCT_BRAND_RELATED_GOODS_IMPORT("SUPPLY_CHAIN_PRODUCT_BRAND_RELATED_GOODS_IMPORT", "商品品牌批量导入关联商品"),
    /**
     * 批量导入数字权益商品
     */
    SUPPLY_CHAIN_VIRTUAL_SKU_IMPORT("SUPPLY_CHAIN_VIRTUAL_SKU_IMPORT", "批量导入数字权益商品"),
    /**
     * 品控导入
     */
    SUPPLY_CHAIN_QUALITY_CONTROL_IMPORT("SUPPLY_CHAIN_QUALITY_CONTROL_IMPORT", "品控导入"),
    /**
     * 选品导入
     */
    SUPPLY_CHAIN_MCH_PRODUCT_IMPORT("SUPPLY_CHAIN_MCH_PRODUCT_IMPORT", "选品导入"),
    /**
     * 三方商品导入
     */
    SUPPLY_CHAIN_ALIBABA_DISTRIBUTE_PRODUCT_IMPORT("SUPPLY_CHAIN_ALIBABA_DISTRIBUTE_PRODUCT_IMPORT", "三方商品导入"),
    /**
     * 采购供应商批量选品导入
     */
    PROCURE_BATCH_MCH_PRODUCT_IMPORT("PROCURE_BATCH_MCH_PRODUCT_IMPORT", "采购供应商批量选品导入"),
    /**
     * 商品库列表导出
     */
    SUPPLY_CHAIN_COMMODITY_WAREHOUSE("SUPPLY_CHAIN_COMMODITY_WAREHOUSE", "商品库列表导出"),
    /**
     * 商品分组列表导出
     */
    SUPPLY_CHAIN_PRODUCT_GROUPING("SUPPLY_CHAIN_PRODUCT_GROUPING", "商品分组列表导出"),
    /**
     * 数字权益导出
     */
    SUPPLY_CHAIN_CHANNEL_VIRTUAL_SKU("SUPPLY_CHAIN_CHANNEL_VIRTUAL_SKU", "数字权益导出"),
    /**
     * 商品日志导出
     */
    SUPPLY_CHAIN_PRODUCT_LOG("SUPPLY_CHAIN_PRODUCT_LOG", "商品日志导出"),
    /**
     * 商品品牌列表导出
     */
    SUPPLY_CHAIN_PRODUCT_BRAND("SUPPLY_CHAIN_PRODUCT_BRAND", "商品品牌列表导出"),
    /**
     * 商品规格列表导出
     */
    SUPPLY_CHAIN_PRODUCT_SKU_STOCK("SUPPLY_CHAIN_PRODUCT_SKU_STOCK", "商品规格列表导出"),
    /**
     * 采购售后订单列表导出
     */
    SUPPLY_CHAIN_PURCHASE_AFTER_SALE_ORDER("SUPPLY_CHAIN_PURCHASE_AFTER_SALE_ORDER", "采购售后订单列表导出"),
    /**
     * 采购订单列表导出
     */
    SUPPLY_CHAIN_PURCHASE_ORDER("SUPPLY_CHAIN_PURCHASE_ORDER", "采购订单列表导出"),
    /**
     * 采购异常订单导出
     */
    SUPPLY_CHAIN_PURCHASE_EXCEPTION_ORDER("SUPPLY_CHAIN_PURCHASE_EXCEPTION_ORDER", "采购异常订单导出");

    private final String type;
    private final String desc;

    @Override
    public String getValue() {
        return this.type;
    }

    @Override
    public String getDescribe() {
        return this.desc;
    }

    public static BizTaskTypeEnum getBizTaskTypeEnum(String type) {
        return Arrays.stream(BizTaskTypeEnum.values()).filter(typeEnum -> EnumUtils.eq(typeEnum, type)).findFirst().orElse(null);
    }
}
